package com.power.sifa.correction.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  夜间活动设置实体类
*/

@Entity
@ApiModel(value="夜间活动设置")
@Data
@Table(name="Crw_rule_night",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Crw_rule_night.Crw_rule_nightPK.class) 用于复合组件
public class Crw_rule_night extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "C序号")
    private String id;

    @Column(nullable = false)
    @ApiModelProperty(value = "规则名称")
    private String name;

    @Column(nullable = false)
    @ApiModelProperty(value = "开始时分hh:mm")
    private String starthm;

    @Column(nullable = false)
    @ApiModelProperty(value = "截止时分hh:mm")
    private String endhm;

    @ApiModelProperty(value = "人员姓名s")
    private String pernames;

    @ApiModelProperty(value = "状态")
    private Integer status;

    @ApiModelProperty(value = "创建人")
    private String createuserid;

    @ApiModelProperty(value = "创建人名称")
    private String createusername;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createtime;

    /**
     *  状态文本
     */
    @Transient
    @FieldEnumText(eum="St_enable", valuefield="status")
    private String status_text;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("name", this.getName());
        map.put("starthm", this.getStarthm());
        map.put("endhm", this.getEndhm());
        map.put("pernames", this.getPernames());
        map.put("status_text", this.status_text);
        map.put("status", this.getStatus());
        map.put("createuserid", this.getCreateuserid());
        map.put("createusername", this.getCreateusername());
        map.put("createtime", this.getCreatetime());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Crw_rule_nightPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Crw_rule_nightPK pk = (Crw_rule_nightPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}